<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
    <link href="/js/datepicker/datepicker.css" rel="stylesheet">
    <link href="/styles/wenda.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/wenda.js"></script>
    <link href="/styles/travelnotes.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>

    <script>
        $(function () {

            //顶：点赞
            $(".zan").click(function () {
                var sid = $(this).data("qd");
                console.log(sid);
                $.get("/wenda/wendaThumbup", {wendaId: sid}, function (data) {
                    console.log(1);
                    if (data.success) {
                        alert("顶成功啦"); //
                        window.location.reload();
                    } else {
                        if (data.code == 102) {
                            alert(data.msg);
                            window.location.reload();
                        } else {
                            alert("你已经顶过了"); //
                            window.location.reload();
                        }
                    }
                });
            })



            // 页面开始时加载排行榜
            var getRankList = function () {
                var rankingId = $('._j_rank_change_flag.on').data('rank');
                $('._j_rank_list').html('');
                $.post('/wenda/ranking', {rankingId: rankingId}, function (data) {
                    $('._j_rank_list').html(data);
                });
            };
            getRankList();

            // 排行榜的的切换动作
            $('._j_rank_change_flag').click(function () {
                getRankList();
            });

        })
    </script>

</head>

<body style="position: relative;">
<#include "community_head.ftl">
<div class="wrapper wrapper-new">
    <div class="col-main">
        <div class="newcate-wrap _j_qa_list">
            <div class="bd newcate-bd">
                <ul class="_j_pager_box">

                    <!-- 循环列表 -->
                    <#list wendas as wenda>
                        <li class="item clearfix _j_question_item" data-qid="">
                            <div class="title">
                                <a href="/wendaDetail/wendaDetail?id=${wenda.id!}" target="_blank">${wenda.title!}</a>
                            </div>
                            <div class="container">
                                <div class="avatar"><a href="/mine/home" target="_blank" class="_j_filter_click"><img
                                                class="_j_filter_click"
                                                src="${wenda.headImgUrl!}"></a>
                                </div>
                                <div class="user-info">
                                    <a class="name _j_filter_click" href="/mine/home"
                                       target="_blank">${wenda.username!}</a>
                                    <a class="level _j_filter_click" href="/mine/home" target="_blank" rel="nofollow">LV.${wenda.level!0}</a>
                                </div>
                                <div class="desc clearfix">
                                    <a href="/wendaDetail/wendaDetail?id=${wenda.id}" style="color: #0f0f0f">
                                        ${wenda.content!}
                                    </a>
                                </div>
                                <div class="tags">
                                    <a class="a-tag _j_filter_click" href="javascript:;"
                                       target="_blank">${wenda.destName!"无标题"}</a>
                                </div>
                                <div class="operate">
                                    <#--点赞-->
                                    <div class="zan" data-qd="${wenda.id!}"><i></i>${wenda.thumbupnum!}</div>

                                    <div class="mdd"><a href="/destination/guide?id=${wenda.destId!1}"
                                                        class="_j_filter_click" target="_blank"><i
                                                    class="_j_filter_click"></i>${wenda.destName!}</a></div>
                                    <div class="cate-share">
                                        <a class="_js_showShare _j_filter_click">分享</a>
                                         <#--<div class="cate-share-pop _j_share_pop hide clearfix" data-title="我要去呼伦贝尔旅行，当地有哪些美食值得去吃？"
                                          data-qid="793682" data-aid="11747597" data-anum="148"
                                          data-content="在燃烧着”永恒之火&quot;的草原上尽情吃肉在中国的饮食中，有许多食品都是从蒙古族那里传来的，如烤肉、涮羊肉等。似乎大家提到蒙古，都有一个感觉，那就是蒙古实在太爱吃肉了。其实蒙古人的饮食、是分为两个季节的，夏季和冬季。夏季为4月至10月，主要食物是奶制品...">
                                          <a title="分享到新浪微博" class="sina _j_do_share _j_filter_click" data-site="wb"
                                            data-username="肉夹馍不会认输"></a>
                                          <a title="分享到QQ空间" class="zone _j_do_share _j_filter_click" data-site="qz"
                                            data-username="肉夹馍不会认输"></a>
                                          <a title="分享到微信" class="weixin _j_do_share_wx _j_filter_click" data-site="wx"
                                            data-username="肉夹馍不会认输"></a>
                                        </div>-->
                                    </div>
                                    <span class="reply">回答 (${wenda.answernum!})</span>
                                    <span class="browse">浏览 (${wenda.viewnum!})</span>
                                    <span class="date">发布于${wenda.createTime?string('yyyy-MM-dd hh:mm:ss')}</span>
                                </div>
                            </div>
                        </li>
                    </#list>

                </ul>
            </div>
        </div>
    </div>
    <div class="col-side">
        <div class="tn-write">
            <a href="/wenda/public" class="btn-ask btn-ask2 btn-add" target="_blank"><i></i>我要提问</a>
        </div>
        <br>
        <div class="rank _j_rank" style="margin-top: 20px;">
            <div class="hd">排行榜</div>
            <div class="bd">
                <ul class="tab-num" data-cs-p="rank_list">
                    <li class="_j_rank_change_flag" data-rank="0" data-cs-d="金牌数">金牌数</li>
                    <li class="_j_rank_change_flag on" data-rank="1" data-cs-d="回答数">回答数</li>
                    <li class="_j_rank_change_flag" data-rank="2" data-cs-d="被顶次数">被顶次数</li>
                </ul>
                <ul class="rank-list _j_rank_list">

                </ul>
            </div>
        </div>
    </div>
</div>
</body>

</html>